Repository navigation
feat(ios): make CoreSVG decoder opt-in - #606
oleksandrzavarzin-callstack wants to merge 4 commits into
Conversation
|
Hey @oleksandrzavarzin-callstack, thanks for picking this up from #566. The codegen, modulemap and SPM work is solid. I'm asking for a change of direction on two points, plus a few smaller findings. 1. Let's not ship a breaking change nowKeep SVG enabled by default in this release, and make disabling it the opt-in. Flipping the default should wait for the next major. Suggested shape: a single tri-state flag, so the next major doesn't need a new one:
Please flag the upcoming change in these places:
2.
|
Closes #565. It is a continuation of @thiagobrez's work from #566.
Summary
The private-CoreSVG decoder is now opt-in on Apple platforms. By default, no SVG source is compiled or linked, and the decoder is never registered with React Native's app-wide image loader.
With the flag set, the tab view decodes SVG icons itself:
How to opt in:
$RNBottomTabsEnableSVG = truein thePodfile, before React Native configures pods, thenpod install["react-native-bottom-tabs", { "enableSVG": true }]RN_BOTTOM_TABS_ENABLE_SVG=1in the environment when SwiftPM resolves packagesChanges on top of #566:
main.Package.swift.SvgDecoder.his removed fromios/include/module.modulemap.artifacts/issue-565/) are removed from the repository.TabViewProvider.swiftis split for SwiftLint. The SVG helpers moved toios/SVGIconLoader.swift.Results
Tested with Xcode 27.0 on an iPhone simulator with iOS 26.5.
main): every iOS app links the CoreSVG code.CoreSVGWrapperand the base64 symbol names are in the binary.CoreSVGWrapper,SvgDecoder,CGSVGDocument,RNBottomTabsDecodeSVGData, or the base64 literals are in the app binary.RCTTabViewComponentViewis present as a control. The Pods project has 0ios/SVGfiles, andimageDataDecoderClassNamesis empty. On the simulator, SF Symbol and PNG icons render, and SVG tabs show their titles with no icon._RNBottomTabsDecodeSVGData,CoreSVGWrapper, and the base64 literals are present. CocoaPods adds exactlyCoreSVG.{h,mm}andSvgDecoder.{h,mm}. Local and remote SVG tab icons render on the simulator.expo prebuild --platform iosruns: without the option there is no flag. WithenableSVG: true, there is one generated block right afterplatform :ios. Removing the option removes the block.swift package dump-packagewithout the variable has noBottomTabsSVGtarget. WithRN_BOTTOM_TABS_ENABLE_SVG=1, it adds the target and the Swift define.yarn lint: 0 errors.yarn test: passes. It includes the newsvg_configuration_test.rbwith 3 runs and 7 assertions.yarn typecheck: passes.main.Before Merging
This is a breaking default, so it ships as a major changeset. After a release, apps that update depend on the new default.
Blast Radius: iOS SVG users
<Image>with an SVG source lose that as well. The decoder was app-wide before. It now serves only tab icons, even with the flag.RN_BOTTOM_TABS_ENABLE_SVGonly from its own environment. If Xcode was started from the Dock, a variable set in a shell does not reach it.